<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <script>
    const obj = { id: 2, name: 'ls' }

    const arr = [
      { id: 1, name: 'zs' },
      { id: 4, name: 'ls' },
      { id: 3, name: 'zl' }
    ]

    // every 的作用：
    // every 方法中是一个假设
    // 循环每一项，想办法推翻这个假设，如果没有被推翻，则返回 true
    // 如果假设被推翻了，则返回 false
    const res = arr.every(item => item.id !== obj.id)
    console.log(res)
  </script>
</body>

</html>